<template>
  <div class="container">
    <div class="ibox-content no-border no-padding-bottom">
      <!--搜索栏-->
      <el-col class="toolbar">
        <el-form :inline="true" size="small" :model="filterForm" ref="filterForm">
          <el-form-item label="ID">
            <el-input v-model="filterForm.id" placeholder="ID"></el-input>
          </el-form-item>
          <el-form-item label="用户ID">
            <el-input v-model="filterForm.uid" placeholder="用户ID"></el-input>
          </el-form-item>
          <el-form-item label="渠道">
            <el-input v-model="filterForm.channel_name" placeholder="渠道"></el-input>
          </el-form-item>
          <el-form-item label="用户">
            <el-input v-model="filterForm.user_phone" placeholder="用户"></el-input>
          </el-form-item>
          <el-form-item label="银行交易流水号">
            <el-input v-model="filterForm.bank_transaction_no" placeholder="银行交易流水号"></el-input>
          </el-form-item>
<!--          <el-form-item label="状态">-->
<!--            <el-select style="width: 178px" v-model="filterForm.gender" placeholder="性别">-->
<!--              <el-option label="全部" value=""></el-option>-->
<!--              <el-option :label="item" :value="key" :key="index"-->
<!--                         v-for="(item,key,index) in selectOptions.gender"></el-option>-->
<!--            </el-select>-->
<!--          </el-form-item>-->
          <div class="hr-line-dashed"></div>
          <br>
          <el-form-item>
            <el-button @click="filterClick" type="primary">查询</el-button>
            <el-button @click="resetFilterForm('filterForm')">重置</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </div>

    <div class="ibox-content">
      <!--表格-->
      <el-table
        ref="multipleTable"
        :data="arrList"
        size="medium"
        border
        highlight-current-row
        tooltip-effect="dark"
        style="width: 100%"
        :max-height="500"
        v-loading="tableLoading"
      >
        <el-table-column prop="id" label="ID"></el-table-column>
        <el-table-column prop="uid" label="用户ID" ></el-table-column>
        <el-table-column prop="user_phone" label="用户" ></el-table-column>
        <el-table-column prop="channel_name" label="渠道" ></el-table-column>
        <el-table-column prop="bank_transaction_no" label="银行交易流水号" ></el-table-column>
        <el-table-column prop="amount" label="提现金额">
          <template slot-scope="scope">
            <span>￥{{scope.row.amount}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="created_at" label="添加时间"></el-table-column>
        <el-table-column prop="updated_at" label="打款时间"></el-table-column>
        <el-table-column prop="status" label="状态" >
          <template slot-scope="scope">
            <span class="" v-show="scope.row.status==1">申请中</span>
            <span class="" v-show="scope.row.status==2">打款中</span>
            <span class="green" v-show="scope.row.status==10">已付款</span>
            <span class="red" v-show="scope.row.status==30">异常</span>
            <span class="" v-show="scope.row.status==99">已拒绝</span>
          </template>
        </el-table-column>
      </el-table>
      <!--分页工具条-->
      <div v-show="arrList.length>0" style="margin-top: 18px;text-align: center">
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pageInfo.currPage"
          :page-sizes="[20]"
          :page-size="pageInfo.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageInfo.totalCount">
        </el-pagination>
      </div>
    </div>


  </div>
</template>

<script>
  import {processRecordList} from "../../api/user";

  export default {
    name: "withdrawal_process_record",
    data() {
      return {
        arrList: [],
        pageInfo: {
          totalPage: 0,// 总页数
          totalCount: 0,// 总条数
          pageSize: 0,// 每页条数
          currPage: 1// 当前页
        },
        filterForm: {},
        tableLoading: false,
        tableSelectData: [],
        selectOptions: {},
        chooseTime: ''
      }
    },
    created() {
      this.initData();
    },
    methods: {
      initData() {
        this.tableLoading = true;
        processRecordList({
          page: this.pageInfo.currPage,
          ...this.filterForm
        }).then(res => {
          this.tableLoading = false;
          const {listData, page} = res.data;
          this.arrList = listData;
          this.pageInfo = page
        }).catch(() => {
          this.tableLoading = false
        })
      },
      //分页
      handleCurrentChange(val) {
        // console.log(val);
        this.pageInfo.currPage = val;
        this.initData();
      },
      filterClick() {
        this.pageInfo.currPage = 1;
        this.initData();
      },
      //重置
      resetFilterForm(form) {
        this.$refs[form].resetFields();
        this.filterForm = {};
        this.chooseTime = '';
        this.pageInfo.currPage = 1;
        this.initData();
      },
    }
  }
</script>

<style scoped lang="scss">

</style>
